
import { _decorator, Component, Node, AssetManager, assetManager } from 'cc';
const { ccclass, property } = _decorator;

export type ICallback = (bundle: AssetManager.Bundle) => void; //

export class ResMgr {
    static m_bundle: AssetManager.Bundle;

    static loadBundle(name: string, onComplete: ICallback, caller: any) {
        if (ResMgr.m_bundle != null) {
            onComplete.call(caller, this.m_bundle)
        } else {
            assetManager.loadBundle(name, (err, bundle) => {
                if (err) {

                }
                ResMgr.m_bundle = bundle;
                onComplete.call(caller, this.m_bundle);
            });
        }

    }
}

